// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   XYChart.java

package org.achartengine.chart;

import android.graphics.*;
import java.util.*;
import org.achartengine.model.*;
import org.achartengine.renderer.*;
import org.achartengine.util.MathHelper;

// Referenced classes of package org.achartengine.chart:
//			AbstractChart, ScatterChart

public abstract class XYChart extends AbstractChart
{

	protected XYMultipleSeriesDataset mDataset;
	protected XYMultipleSeriesRenderer mRenderer;
	private float mScale;
	private float mTranslate;
	private Point mCenter;
	private Rect mScreenR;
	private Map mCalcRange;
	private Map clickableAreas;

	protected XYChart()
	{
		mCalcRange = new HashMap();
		clickableAreas = new HashMap();
	}

	public XYChart(XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
	{
		mCalcRange = new HashMap();
		clickableAreas = new HashMap();
		mDataset = xymultipleseriesdataset;
		mRenderer = xymultipleseriesrenderer;
	}

	protected void setDatasetRenderer(XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
	{
		mDataset = xymultipleseriesdataset;
		mRenderer = xymultipleseriesrenderer;
	}

	public void draw(Canvas canvas, int i, int j, int k, int l, Paint paint)
	{
		paint.setAntiAlias(mRenderer.isAntialiasing());
		int i1 = getLegendSize(mRenderer, l / 5, mRenderer.getAxisTitleTextSize());
		int ai[] = mRenderer.getMargins();
		int j1 = i + ai[1];
		int k1 = j + ai[0];
		int l1 = (i + k) - ai[3];
		int i2 = mDataset.getSeriesCount();
		String as[] = new String[i2];
		for (int j2 = 0; j2 < i2; j2++)
			as[j2] = mDataset.getSeriesAt(j2).getTitle();

		if (mRenderer.isFitLegend() && mRenderer.isShowLegend())
			i1 = drawLegend(canvas, mRenderer, as, j1, l1, j, k, l, i1, paint, true);
		int k2 = (j + l) - ai[2] - i1;
		if (mScreenR == null)
			mScreenR = new Rect();
		mScreenR.set(j1, k1, l1, k2);
		drawBackground(mRenderer, canvas, i, j, k, l, paint, false, 0);
		if (paint.getTypeface() == null || !paint.getTypeface().toString().equals(mRenderer.getTextTypefaceName()) || paint.getTypeface().getStyle() != mRenderer.getTextTypefaceStyle())
			paint.setTypeface(Typeface.create(mRenderer.getTextTypefaceName(), mRenderer.getTextTypefaceStyle()));
		org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation orientation = mRenderer.getOrientation();
		if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.VERTICAL)
		{
			l1 -= i1;
			k2 += i1 - 20;
		}
		int l2 = orientation.getAngle();
		boolean flag = l2 == 90;
		mScale = (float)l / (float)k;
		mTranslate = Math.abs(k - l) / 2;
		if (mScale < 1.0F)
			mTranslate *= -1F;
		mCenter = new Point((i + k) / 2, (j + l) / 2);
		if (flag)
			transform(canvas, l2, false);
		int i3 = 0x80000001;
		for (int j3 = 0; j3 < i2; j3++)
			i3 = Math.max(i3, mDataset.getSeriesAt(j3).getScaleNumber());

		if (++i3 < 0)
			return;
		double ad[] = new double[i3];
		double ad1[] = new double[i3];
		double ad2[] = new double[i3];
		double ad3[] = new double[i3];
		boolean aflag[] = new boolean[i3];
		boolean aflag1[] = new boolean[i3];
		boolean aflag2[] = new boolean[i3];
		boolean aflag3[] = new boolean[i3];
		for (int k3 = 0; k3 < i3; k3++)
		{
			ad[k3] = mRenderer.getXAxisMin(k3);
			ad1[k3] = mRenderer.getXAxisMax(k3);
			ad2[k3] = mRenderer.getYAxisMin(k3);
			ad3[k3] = mRenderer.getYAxisMax(k3);
			aflag[k3] = mRenderer.isMinXSet(k3);
			aflag1[k3] = mRenderer.isMaxXSet(k3);
			aflag2[k3] = mRenderer.isMinYSet(k3);
			aflag3[k3] = mRenderer.isMaxYSet(k3);
			if (mCalcRange.get(Integer.valueOf(k3)) == null)
				mCalcRange.put(Integer.valueOf(k3), new double[4]);
		}

		double ad4[] = new double[i3];
		double ad5[] = new double[i3];
		for (int l3 = 0; l3 < i2; l3++)
		{
			XYSeries xyseries = mDataset.getSeriesAt(l3);
			int k4 = xyseries.getScaleNumber();
			if (xyseries.getItemCount() == 0)
				continue;
			if (!aflag[k4])
			{
				double d = xyseries.getMinX();
				ad[k4] = Math.min(ad[k4], d);
				((double[])mCalcRange.get(Integer.valueOf(k4)))[0] = ad[k4];
			}
			if (!aflag1[k4])
			{
				double d1 = xyseries.getMaxX();
				ad1[k4] = Math.max(ad1[k4], d1);
				((double[])mCalcRange.get(Integer.valueOf(k4)))[1] = ad1[k4];
			}
			if (!aflag2[k4])
			{
				double d2 = xyseries.getMinY();
				ad2[k4] = Math.min(ad2[k4], (float)d2);
				((double[])mCalcRange.get(Integer.valueOf(k4)))[2] = ad2[k4];
			}
			if (!aflag3[k4])
			{
				double d3 = xyseries.getMaxY();
				ad3[k4] = Math.max(ad3[k4], (float)d3);
				((double[])mCalcRange.get(Integer.valueOf(k4)))[3] = ad3[k4];
			}
		}

		for (int i4 = 0; i4 < i3; i4++)
		{
			if (ad1[i4] - ad[i4] != 0.0D)
				ad4[i4] = (double)(l1 - j1) / (ad1[i4] - ad[i4]);
			if (ad3[i4] - ad2[i4] != 0.0D)
				ad5[i4] = (float)((double)(k2 - k1) / (ad3[i4] - ad2[i4]));
		}

		boolean flag1 = false;
		clickableAreas = new HashMap();
		for (int j4 = 0; j4 < i2; j4++)
		{
			XYSeries xyseries1 = mDataset.getSeriesAt(j4);
			int l4 = xyseries1.getScaleNumber();
			if (xyseries1.getItemCount() == 0)
				continue;
			flag1 = true;
			SimpleSeriesRenderer simpleseriesrenderer = mRenderer.getSeriesRendererAt(j4);
			int i5 = xyseries1.getItemCount();
			int k5 = i5;
			int j6 = k5 * 2;
			ArrayList arraylist = new ArrayList();
			float f1 = Math.min(k2, (float)((double)k2 + ad5[l4] * ad2[l4]));
			LinkedList linkedlist = new LinkedList();
			clickableAreas.put(Integer.valueOf(j4), linkedlist);
			for (int l7 = 0; l7 < j6; l7 += 2)
			{
				int j8 = l7 / 2;
				double d5 = xyseries1.getY(j8);
				if (d5 != 1.7976931348623157E+308D)
				{
					arraylist.add(Float.valueOf((float)((double)j1 + ad4[l4] * (xyseries1.getX(j8) - ad[l4]))));
					arraylist.add(Float.valueOf((float)((double)k2 - ad5[l4] * (d5 - ad2[l4]))));
					continue;
				}
				if (isRenderNullValues())
				{
					arraylist.add(Float.valueOf((float)((double)j1 + ad4[l4] * (xyseries1.getX(j8) - ad[l4]))));
					arraylist.add(Float.valueOf((float)((double)k2 - ad5[l4] * -ad2[l4])));
					continue;
				}
				if (arraylist.size() > 0)
				{
					drawSeries(xyseries1, canvas, paint, arraylist, simpleseriesrenderer, f1, j4, orientation);
					RectF arectf1[] = clickableAreasForPoints(MathHelper.getFloats(arraylist), f1, j4);
					linkedlist.addAll(Arrays.asList(arectf1));
					arraylist.clear();
				}
				linkedlist.add(null);
			}

			if (arraylist.size() > 0)
			{
				drawSeries(xyseries1, canvas, paint, arraylist, simpleseriesrenderer, f1, j4, orientation);
				RectF arectf[] = clickableAreasForPoints(MathHelper.getFloats(arraylist), f1, j4);
				linkedlist.addAll(Arrays.asList(arectf));
			}
		}

		drawBackground(mRenderer, canvas, i, k2, k, l - k2, paint, true, mRenderer.getMarginsColor());
		drawBackground(mRenderer, canvas, i, j, k, ai[0], paint, true, mRenderer.getMarginsColor());
		if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.HORIZONTAL)
		{
			drawBackground(mRenderer, canvas, i, j, j1 - i, l - j, paint, true, mRenderer.getMarginsColor());
			drawBackground(mRenderer, canvas, l1, j, ai[3], l - j, paint, true, mRenderer.getMarginsColor());
		} else
		if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.VERTICAL)
		{
			drawBackground(mRenderer, canvas, l1, j, k - l1, l - j, paint, true, mRenderer.getMarginsColor());
			drawBackground(mRenderer, canvas, i, j, j1 - i, l - j, paint, true, mRenderer.getMarginsColor());
		}
		boolean flag2 = mRenderer.isShowLabels() && flag1;
		boolean flag3 = mRenderer.isShowGrid();
		boolean flag4 = mRenderer.isShowCustomTextGrid();
		if (flag2 || flag3)
		{
			List list = getValidLabels(MathHelper.getLabels(ad[0], ad1[0], mRenderer.getXLabels()));
			HashMap hashmap = new HashMap();
			for (int l5 = 0; l5 < i3; l5++)
				hashmap.put(Integer.valueOf(l5), getValidLabels(MathHelper.getLabels(ad2[l5], ad3[l5], mRenderer.getYLabels())));

			int i6 = j1;
			if (flag2)
			{
				paint.setColor(mRenderer.getLabelsColor());
				paint.setTextSize(mRenderer.getLabelsTextSize());
				paint.setTextAlign(mRenderer.getXLabelsAlign());
				if (mRenderer.getXLabelsAlign() == android.graphics.Paint.Align.LEFT)
					i6 = (int)((float)i6 + mRenderer.getLabelsTextSize() / 4F);
			}
			drawXLabels(list, mRenderer.getXTextLabelLocations(), canvas, paint, i6, k1, k2, ad4[0], ad[0], ad1[0]);
			for (int k6 = 0; k6 < i3; k6++)
			{
				paint.setTextAlign(mRenderer.getYLabelsAlign(k6));
				List list1 = (List)hashmap.get(Integer.valueOf(k6));
				int j7 = list1.size();
				for (int k7 = 0; k7 < j7; k7++)
				{
					double d4 = ((Double)list1.get(k7)).doubleValue();
					android.graphics.Paint.Align align2 = mRenderer.getYAxisAlign(k6);
					boolean flag6 = mRenderer.getYTextLabel(Double.valueOf(d4), k6) != null;
					float f3 = (float)((double)k2 - ad5[k6] * (d4 - ad2[k6]));
					if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.HORIZONTAL)
					{
						if (flag2 && !flag6)
						{
							paint.setColor(mRenderer.getLabelsColor());
							if (align2 == android.graphics.Paint.Align.LEFT)
							{
								canvas.drawLine(j1 + getLabelLinePos(align2), f3, j1, f3, paint);
								drawText(canvas, getLabel(d4), j1, f3 - 2.0F, paint, mRenderer.getYLabelsAngle());
							} else
							{
								canvas.drawLine(l1, f3, l1 + getLabelLinePos(align2), f3, paint);
								drawText(canvas, getLabel(d4), l1, f3 - 2.0F, paint, mRenderer.getYLabelsAngle());
							}
						}
						if (flag3)
						{
							paint.setColor(mRenderer.getGridColor());
							canvas.drawLine(j1, f3, l1, f3, paint);
						}
						continue;
					}
					if (orientation != org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.VERTICAL)
						continue;
					if (flag2 && !flag6)
					{
						paint.setColor(mRenderer.getLabelsColor());
						canvas.drawLine(l1 - getLabelLinePos(align2), f3, l1, f3, paint);
						drawText(canvas, getLabel(d4), l1 + 10, f3 - 2.0F, paint, mRenderer.getYLabelsAngle());
					}
					if (flag3)
					{
						paint.setColor(mRenderer.getGridColor());
						canvas.drawLine(l1, f3, j1, f3, paint);
					}
				}

			}

			if (flag2)
			{
				paint.setColor(mRenderer.getLabelsColor());
				for (int l6 = 0; l6 < i3; l6++)
				{
					android.graphics.Paint.Align align = mRenderer.getYAxisAlign(l6);
					Double adouble[] = mRenderer.getYTextLabelLocations(l6);
					Double adouble1[] = adouble;
					int i8 = adouble1.length;
					for (int k8 = 0; k8 < i8; k8++)
					{
						Double double1 = adouble1[k8];
						if (ad2[l6] > double1.doubleValue() || double1.doubleValue() > ad3[l6])
							continue;
						float f2 = (float)((double)k2 - ad5[l6] * (double1.doubleValue() - ad2[l6]));
						String s = mRenderer.getYTextLabel(double1, l6);
						paint.setColor(mRenderer.getLabelsColor());
						if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.HORIZONTAL)
						{
							if (align == android.graphics.Paint.Align.LEFT)
							{
								canvas.drawLine(j1 + getLabelLinePos(align), f2, j1, f2, paint);
								drawText(canvas, s, j1, f2 - 2.0F, paint, mRenderer.getYLabelsAngle());
							} else
							{
								canvas.drawLine(l1, f2, l1 + getLabelLinePos(align), f2, paint);
								drawText(canvas, s, l1, f2 - 2.0F, paint, mRenderer.getYLabelsAngle());
							}
							if (flag4)
							{
								paint.setColor(mRenderer.getGridColor());
								canvas.drawLine(j1, f2, l1, f2, paint);
							}
							continue;
						}
						canvas.drawLine(l1 - getLabelLinePos(align), f2, l1, f2, paint);
						drawText(canvas, s, l1 + 10, f2 - 2.0F, paint, mRenderer.getYLabelsAngle());
						if (flag4)
						{
							paint.setColor(mRenderer.getGridColor());
							canvas.drawLine(l1, f2, j1, f2, paint);
						}
					}

				}

			}
			if (flag2)
			{
				paint.setColor(mRenderer.getLabelsColor());
				float f = mRenderer.getAxisTitleTextSize();
				paint.setTextSize(f);
				paint.setTextAlign(android.graphics.Paint.Align.CENTER);
				if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.HORIZONTAL)
				{
					drawText(canvas, mRenderer.getXTitle(), i + k / 2, (float)k2 + (mRenderer.getLabelsTextSize() * 4F) / 3F + f, paint, 0.0F);
					for (int i7 = 0; i7 < i3; i7++)
					{
						android.graphics.Paint.Align align1 = mRenderer.getYAxisAlign(i7);
						if (align1 == android.graphics.Paint.Align.LEFT)
							drawText(canvas, mRenderer.getYTitle(i7), (float)i + f, j + l / 2, paint, -90F);
						else
							drawText(canvas, mRenderer.getYTitle(i7), i + k, j + l / 2, paint, -90F);
					}

					paint.setTextSize(mRenderer.getChartTitleTextSize());
					drawText(canvas, mRenderer.getChartTitle(), i + k / 2, (float)j + mRenderer.getChartTitleTextSize(), paint, 0.0F);
				} else
				if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.VERTICAL)
				{
					drawText(canvas, mRenderer.getXTitle(), i + k / 2, (float)(j + l) - f, paint, -90F);
					drawText(canvas, mRenderer.getYTitle(), l1 + 20, j + l / 2, paint, 0.0F);
					paint.setTextSize(mRenderer.getChartTitleTextSize());
					drawText(canvas, mRenderer.getChartTitle(), (float)i + f, k1 + l / 2, paint, 0.0F);
				}
			}
		}
		if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.HORIZONTAL)
			drawLegend(canvas, mRenderer, as, j1, l1, j, k, l, i1, paint, false);
		else
		if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.VERTICAL)
		{
			transform(canvas, l2, true);
			drawLegend(canvas, mRenderer, as, j1, l1, j, k, l, i1, paint, false);
			transform(canvas, l2, false);
		}
		if (mRenderer.isShowAxes())
		{
			paint.setColor(mRenderer.getAxesColor());
			canvas.drawLine(j1, k2, l1, k2, paint);
			boolean flag5 = false;
			for (int j5 = 0; j5 < i3 && !flag5; j5++)
				flag5 = mRenderer.getYAxisAlign(j5) == android.graphics.Paint.Align.RIGHT;

			if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.HORIZONTAL)
			{
				canvas.drawLine(j1, k1, j1, k2, paint);
				if (flag5)
					canvas.drawLine(l1, k1, l1, k2, paint);
			} else
			if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.VERTICAL)
				canvas.drawLine(l1, k1, l1, k2, paint);
		}
		if (flag)
			transform(canvas, l2, true);
	}

	protected Rect getScreenR()
	{
		return mScreenR;
	}

	protected void setScreenR(Rect rect)
	{
		mScreenR = rect;
	}

	private List getValidLabels(List list)
	{
		ArrayList arraylist = new ArrayList(list);
		Iterator iterator = list.iterator();
		do
		{
			if (!iterator.hasNext())
				break;
			Double double1 = (Double)iterator.next();
			if (double1.isNaN())
				arraylist.remove(double1);
		} while (true);
		return arraylist;
	}

	protected void drawSeries(XYSeries xyseries, Canvas canvas, Paint paint, List list, SimpleSeriesRenderer simpleseriesrenderer, float f, int i, 
			org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation orientation)
	{
		BasicStroke basicstroke = simpleseriesrenderer.getStroke();
		android.graphics.Paint.Cap cap = paint.getStrokeCap();
		android.graphics.Paint.Join join = paint.getStrokeJoin();
		float f1 = paint.getStrokeMiter();
		PathEffect patheffect = paint.getPathEffect();
		android.graphics.Paint.Style style = paint.getStyle();
		if (basicstroke != null)
		{
			DashPathEffect dashpatheffect = null;
			if (basicstroke.getIntervals() != null)
				dashpatheffect = new DashPathEffect(basicstroke.getIntervals(), basicstroke.getPhase());
			setStroke(basicstroke.getCap(), basicstroke.getJoin(), basicstroke.getMiter(), android.graphics.Paint.Style.FILL_AND_STROKE, dashpatheffect, paint);
		}
		float af[] = MathHelper.getFloats(list);
		drawSeries(canvas, paint, af, simpleseriesrenderer, f, i);
		if (isRenderPoints(simpleseriesrenderer))
		{
			ScatterChart scatterchart = getPointsChart();
			if (scatterchart != null)
				scatterchart.drawSeries(canvas, paint, af, simpleseriesrenderer, f, i);
		}
		paint.setTextSize(simpleseriesrenderer.getChartValuesTextSize());
		if (orientation == org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation.HORIZONTAL)
			paint.setTextAlign(android.graphics.Paint.Align.CENTER);
		else
			paint.setTextAlign(android.graphics.Paint.Align.LEFT);
		if (simpleseriesrenderer.isDisplayChartValues())
		{
			paint.setTextAlign(simpleseriesrenderer.getChartValuesTextAlign());
			drawChartValuesText(canvas, xyseries, simpleseriesrenderer, paint, af, i);
		}
		if (basicstroke != null)
			setStroke(cap, join, f1, style, patheffect, paint);
	}

	private void setStroke(android.graphics.Paint.Cap cap, android.graphics.Paint.Join join, float f, android.graphics.Paint.Style style, PathEffect patheffect, Paint paint)
	{
		paint.setStrokeCap(cap);
		paint.setStrokeJoin(join);
		paint.setStrokeMiter(f);
		paint.setPathEffect(patheffect);
		paint.setStyle(style);
	}

	protected void drawChartValuesText(Canvas canvas, XYSeries xyseries, SimpleSeriesRenderer simpleseriesrenderer, Paint paint, float af[], int i)
	{
		for (int j = 0; j < af.length; j += 2)
			drawText(canvas, getLabel(xyseries.getY(j / 2)), af[j], af[j + 1] - simpleseriesrenderer.getChartValuesSpacing(), paint, 0.0F);

	}

	protected void drawText(Canvas canvas, String s, float f, float f1, Paint paint, float f2)
	{
		float f3 = (float)(-mRenderer.getOrientation().getAngle()) + f2;
		if (f3 != 0.0F)
			canvas.rotate(f3, f, f1);
		canvas.drawText(s, f, f1, paint);
		if (f3 != 0.0F)
			canvas.rotate(-f3, f, f1);
	}

	private void transform(Canvas canvas, float f, boolean flag)
	{
		if (flag)
		{
			canvas.scale(1.0F / mScale, mScale);
			canvas.translate(mTranslate, -mTranslate);
			canvas.rotate(-f, mCenter.getX(), mCenter.getY());
		} else
		{
			canvas.rotate(f, mCenter.getX(), mCenter.getY());
			canvas.translate(-mTranslate, mTranslate);
			canvas.scale(mScale, 1.0F / mScale);
		}
	}

	protected String getLabel(double d)
	{
		String s = "";
		if (d == (double)Math.round(d))
			s = (new StringBuilder()).append(Math.round(d)).append("").toString();
		else
			s = (new StringBuilder()).append(d).append("").toString();
		return s;
	}

	protected void drawXLabels(List list, Double adouble[], Canvas canvas, Paint paint, int i, int j, int k, 
			double d, double d1, double d2)
	{
		int l = list.size();
		boolean flag = mRenderer.isShowLabels();
		boolean flag1 = mRenderer.isShowGrid();
		for (int i1 = 0; i1 < l; i1++)
		{
			double d3 = ((Double)list.get(i1)).doubleValue();
			float f = (float)((double)i + d * (d3 - d1));
			if (flag)
			{
				paint.setColor(mRenderer.getLabelsColor());
				canvas.drawLine(f, k, f, (float)k + mRenderer.getLabelsTextSize() / 3F, paint);
				drawText(canvas, getLabel(d3), f, (float)k + (mRenderer.getLabelsTextSize() * 4F) / 3F, paint, mRenderer.getXLabelsAngle());
			}
			if (flag1)
			{
				paint.setColor(mRenderer.getGridColor());
				canvas.drawLine(f, k, f, j, paint);
			}
		}

		drawXTextLabels(adouble, canvas, paint, flag, i, j, k, d, d1, d2);
	}

	protected void drawXTextLabels(Double adouble[], Canvas canvas, Paint paint, boolean flag, int i, int j, int k, 
			double d, double d1, double d2)
	{
		boolean flag1 = mRenderer.isShowCustomTextGrid();
		if (flag)
		{
			paint.setColor(mRenderer.getLabelsColor());
			Double adouble1[] = adouble;
			int l = adouble1.length;
			for (int i1 = 0; i1 < l; i1++)
			{
				Double double1 = adouble1[i1];
				if (d1 > double1.doubleValue() || double1.doubleValue() > d2)
					continue;
				float f = (float)((double)i + d * (double1.doubleValue() - d1));
				paint.setColor(mRenderer.getLabelsColor());
				canvas.drawLine(f, k, f, (float)k + mRenderer.getLabelsTextSize() / 3F, paint);
				drawText(canvas, mRenderer.getXTextLabel(double1), f, (float)k + (mRenderer.getLabelsTextSize() * 4F) / 3F, paint, mRenderer.getXLabelsAngle());
				if (flag1)
				{
					paint.setColor(mRenderer.getGridColor());
					canvas.drawLine(f, k, f, j, paint);
				}
			}

		}
	}

	public XYMultipleSeriesRenderer getRenderer()
	{
		return mRenderer;
	}

	public XYMultipleSeriesDataset getDataset()
	{
		return mDataset;
	}

	public double[] getCalcRange(int i)
	{
		return (double[])mCalcRange.get(Integer.valueOf(i));
	}

	public void setCalcRange(double ad[], int i)
	{
		mCalcRange.put(Integer.valueOf(i), ad);
	}

	public double[] toRealPoint(float f, float f1)
	{
		return toRealPoint(f, f1, 0);
	}

	public double[] toScreenPoint(double ad[])
	{
		return toScreenPoint(ad, 0);
	}

	private int getLabelLinePos(android.graphics.Paint.Align align)
	{
		int i = 4;
		if (align == android.graphics.Paint.Align.LEFT)
			i = -i;
		return i;
	}

	public double[] toRealPoint(float f, float f1, int i)
	{
		double d = mRenderer.getXAxisMin(i);
		double d1 = mRenderer.getXAxisMax(i);
		double d2 = mRenderer.getYAxisMin(i);
		double d3 = mRenderer.getYAxisMax(i);
		return (new double[] {
			((double)(f - (float)mScreenR.left) * (d1 - d)) / (double)mScreenR.width() + d, ((double)((float)(mScreenR.top + mScreenR.height()) - f1) * (d3 - d2)) / (double)mScreenR.height() + d2
		});
	}

	public double[] toScreenPoint(double ad[], int i)
	{
		double d = mRenderer.getXAxisMin(i);
		double d1 = mRenderer.getXAxisMax(i);
		double d2 = mRenderer.getYAxisMin(i);
		double d3 = mRenderer.getYAxisMax(i);
		if (!mRenderer.isMinXSet(i) || !mRenderer.isMaxXSet(i) || !mRenderer.isMinXSet(i) || !mRenderer.isMaxYSet(i))
		{
			double ad1[] = getCalcRange(i);
			d = ad1[0];
			d1 = ad1[1];
			d2 = ad1[2];
			d3 = ad1[3];
		}
		return (new double[] {
			((ad[0] - d) * (double)mScreenR.width()) / (d1 - d) + (double)mScreenR.left, ((d3 - ad[1]) * (double)mScreenR.height()) / (d3 - d2) + (double)mScreenR.top
		});
	}

	public SeriesSelection getSeriesAndPointForScreenCoordinate(Point point)
	{
		if (clickableAreas != null)
		{
label0:
			for (int i = clickableAreas.size() - 1; i >= 0; i--)
			{
				int j = 0;
				if (clickableAreas.get(Integer.valueOf(i)) == null)
					continue;
				Iterator iterator = ((List)clickableAreas.get(Integer.valueOf(i))).iterator();
				do
				{
					if (!iterator.hasNext())
						continue label0;
					RectF rectf = (RectF)iterator.next();
					if (rectf != null && rectf.contains(point.getX(), point.getY()))
					{
						XYSeries xyseries = mDataset.getSeriesAt(i);
						return new SeriesSelection(i, j, xyseries.getX(j), xyseries.getY(j));
					}
					j++;
				} while (true);
			}

		}
		return super.getSeriesAndPointForScreenCoordinate(point);
	}

	public abstract void drawSeries(Canvas canvas, Paint paint, float af[], SimpleSeriesRenderer simpleseriesrenderer, float f, int i);

	protected abstract RectF[] clickableAreasForPoints(float af[], float f, int i);

	protected boolean isRenderNullValues()
	{
		return false;
	}

	public boolean isRenderPoints(SimpleSeriesRenderer simpleseriesrenderer)
	{
		return false;
	}

	public double getDefaultMinimum()
	{
		return 1.7976931348623157E+308D;
	}

	public ScatterChart getPointsChart()
	{
		return null;
	}

	public abstract String getChartType();
}
